from building import *

cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = []

if GetDepend('SUPPORT_AD_CMP'):
    CPPPATH.append(cwd + '/AdCmp')
    src += Glob('AdCmp/AdCmp.c') 
    if GetDepend('SUPPORT_AD_CMP_HC32F4'):
      src += Glob('AdCmp/AdCmp_HC32F4.c') 

if GetDepend('SUPPORT_AIR_VALVE'):
    CPPPATH.append(cwd + '/AirValve')
    src += Glob('AirValve/AirValve.c') 
    if GetDepend('SUPPORT_AIR_VALVE_SMENU'):
      src += Glob('AirValve/AirValve_SMenu.c') 
    elif GetDepend('SUPPORT_AIR_VALVE_L3K1'):
      src += Glob('AirValve/AirValve_L3K1.c') 

if GetDepend('SUPPORT_API'):
    CPPPATH.append(cwd + '/Api')
    src += Glob('Api/ApiDataInfo.c')  

if GetDepend('SUPPORT_BATTERY_MNG'):
    CPPPATH.append(cwd + '/BatteryMng')
    src += Glob('BatteryMng/BatteryMng.c')  
    if GetDepend('SUPPORT_BATTERY_MNG_TMENU'):
      src += Glob('BatteryMng/BatteryMng_TMenu.c') 

if GetDepend('SUPPORT_CUSTOMLUT'):
    CPPPATH.append(cwd + '/CustomLut')
    src += Glob('CustomLut/CustomLut.c')  
    if GetDepend('SUPPORT_CUSTOMLUT_SERIALIZE'):
      src += Glob('CustomLut/CustomLut_Serialize.c')      
    if GetDepend('SUPPORT_CUSTOMLUT_ARY'):
      src += Glob('CustomLut/CustomLut_Ary.c')
elif  GetDepend('SUPPORT_CUSTOMLUT_M'):
    CPPPATH.append(cwd + '/CustomLutM')
    src += Glob('CustomLutM/CustomLut.c')  
elif  GetDepend('SUPPORT_CUSTOMLUT_S'):
    CPPPATH.append(cwd + '/CustomLutS')
    src += Glob('CustomLutS/CustomLut.c') 
    if GetDepend('SUPPORT_CUSTOMLUT_S_SERIALIZE'):
      src += Glob('CustomLutS/CustomLut_Serialize.c') 

if GetDepend('SUPPORT_DEF_STD_TYPE'):
    CPPPATH.append(cwd + '/DefStdType')

if GetDepend('SUPPORT_DELAY'):
    CPPPATH.append(cwd + '/Delay')
    if GetDepend('SUPPORT_DELAY_CM0'):
      src += Glob('Delay/Delay_CM0.c')
    elif GetDepend('SUPPORT_DELAY_CM4F'):
      src += Glob('Delay/Delay_CM4F.c')
    elif GetDepend('SUPPORT_DELAY_PIC'):
      src += Glob('Delay/Delay_PIC.c')      
    elif GetDepend('SUPPORT_DELAY_STM32'):
      src += Glob('Delay/Delay_STM32.c') 
    elif GetDepend('SUPPORT_DELAY_RISCV'):
      src += Glob('Delay/Delay_RiscV.c')   

if GetDepend('SUPPORT_DISP_ADR_TIMER'):
    CPPPATH.append(cwd + '/DispAdrTimer')
    src += Glob('DispAdrTimer/DispAdrTimer.c')  

if GetDepend('SUPPORT_DYNA_ID_FILTER'):
    CPPPATH.append(cwd + '/DyncIdFilter')
    src += Glob('DyncIdFilter/DyncIdFilter.c')  
    src += Glob('DyncIdFilter/DyncIdFilterMng.c')  

if GetDepend('SUPPORT_EO8'):
    CPPPATH.append(cwd + '/EO8')
    if GetDepend('SUPPORT_EO8_GPO595'):
        src += Glob('EO8/EO8_GPO595.c')  
    elif GetDepend('SUPPORT_EO8_SPI3_MIO_595'):
        src += Glob('EO8/EO8_Spi3mIo595.c')  

if GetDepend('SUPPORT_EVENT_POOL'):
    CPPPATH.append(cwd + '/EventPool')
    src += Glob('EventPool/EventPool.c') 

if GetDepend('SUPPORT_G_CFG'):
    CPPPATH.append(cwd + '/gCfg')
    src += Glob('gCfg/gCfg.c') 

if GetDepend('SUPPORT_G_FLAG'):
    CPPPATH.append(cwd + '/gFlag')
    src += Glob('gFlag/gFlag.c') 

if GetDepend('SUPPORT_HOUR_INC_EEPROM'):
    CPPPATH.append(cwd + '/HourIncEeprom')
    src += Glob('HourIncEeprom/HourIncEeprom.c') 
elif GetDepend('SUPPORT_HOUR_INC_FLASH'):
    CPPPATH.append(cwd + '/HourIncFlash')
    src += Glob('HourIncFlash/HourIncFlash.c') 
    if GetDepend('SUPPORT_HOUR_INC_FLASH_SMENU'):
        src += Glob('HourIncFlash/HourIncFlash_SMenu.c')   

if GetDepend('SUPPORT_HUMITURE'):
    CPPPATH.append(cwd + '/Humiture')
    src += Glob('Humiture/Humiture.c') 
    if GetDepend('SUPPORT_HUMITURE_DH11'):
        src += Glob('Humiture/Humiture_DH11.c') 

if GetDepend('SUPPORT_HW_CFG_ASSIST'):
    CPPPATH.append(cwd + '/HwCfgAssist')
    src += Glob('HwCfgAssist/HwCfgAssist.c') 
  
if GetDepend('SUPPORT_INFO_BASE_DYNC_MNG'):
    CPPPATH.append(cwd + '/InfoBase')
    src += Glob('InfoBase/InfoBaseDyncMng.c') 

if GetDepend('SUPPORT_LIGHT_CH'):
    CPPPATH.append(cwd + '/LightCh')
    src += Glob('LightCh/LightCh.c') 

if GetDepend('SUPPORT_STD_LUT'):
    CPPPATH.append(cwd + '/LUT')
    if GetDepend('SUPPORT_STD_LUT_U8_REVERSE'):
        src += Glob('LUT/LUT_U8Reverse.c') 

if GetDepend('SUPPORT_MATH'):
    CPPPATH.append(cwd + '/math')
    src += Glob('math/math_3.c') 
    if GetDepend('SUPPORT_MATH4'):
        src += Glob('math/math_4.c') 

if GetDepend('SUPPORT_MEM_MNG'):
    CPPPATH.append(cwd + '/MemMng')
    src += Glob('MemMng/MemMng_heap_1.c') 

elif GetDepend('SUPPORT_MEO8'):
    CPPPATH.append(cwd + '/mEO8')
    if GetDepend('SUPPORT_MEO8_GPO595'):
        src += Glob('mEO8/MEO8_GPO595.c')  
    elif GetDepend('SUPPORT_MEO8_GPO573'):
        src += Glob('mEO8/MEO8_GPO573.c')  

elif GetDepend('SUPPORT_MVC'):
    CPPPATH.append(cwd + '/MVC')
    if GetDepend('SUPPORT_MVC_HC32'):
        src += Glob('MVC/MVC_HC32.c') 

if GetDepend('SUPPORT_NOLINEAR_CONVERT'):
    CPPPATH.append(cwd + '/NolinearConvert')
    src += Glob('NolinearConvert/NolinearConvert.c') 

if GetDepend('SUPPORT_PERIOD_PWM_GEN'):
    CPPPATH.append(cwd + '/PeriodPwmGen')
    if GetDepend('SUPPORT_PIC_CCP'):
      src += Glob('PeriodPwmGen/PeriodPwmGen_PicCPP.c') 

if GetDepend('SUPPORT_POT'):
    CPPPATH.append(cwd + '/Pot')
    src += Glob('Pot/Pot.c') 
    if GetDepend('SUPPORT_POT_CAT5171'):
      src += Glob('Pot/Pot_cbCAT5171.c') 
elif GetDepend('SUPPORT_POT_S'):
    CPPPATH.append(cwd + '/PotS')
    src += Glob('PotS/Pot.c') 
    if GetDepend('SUPPORT_POT_S_CAT5171'):
      src += Glob('PotS/Pot_cbCAT5171_Sio.c') 

if GetDepend('SUPPORT_POW_OUT_MNG'):
    CPPPATH.append(cwd + '/PowOutMng')
    src += Glob('PowOutMng/PowOutMng.c') 
    if GetDepend('SUPPORT_POW_OUT_MNG_TMENU'):
      src += Glob('PowOutMng/PowOutMng_TMenu.c') 

if GetDepend('SUPPORT_PRESSURE'):
    CPPPATH.append(cwd + '/Pressure')
    if GetDepend('SUPPORT_PRESSURE_SPL06'):
      src += Glob('Pressure/Pressure_SPL06.c') 

if GetDepend('SUPPORT_QC_MNG'):
    CPPPATH.append(cwd + '/QcMng')
    src += Glob('QcMng/QcMng.c')     
    if GetDepend('SUPPORT_QC_MNG_CH224K'):
      src += Glob('QcMng/QcMng_cbCH224K.c') 
    if GetDepend('SUPPORT_QC_MNG_TMENU'):
      src += Glob('QcMng/QcMng_TMenu.c') 

if GetDepend('SUPPORT_RESOURCE_INDEX'):
    CPPPATH.append(cwd + '/ResourceIndex')
    src += Glob('ResourceIndex/ResourceIndex.c') 

if GetDepend('SUPPORT_RESOURCE_PLOT'):
    CPPPATH.append(cwd + '/ResourcePlot')
    src += Glob('ResourcePlot/ResourcePlot.c') 
    src += Glob('ResourcePlot/RP_AryArea.c') 
    src += Glob('ResourcePlot/RP_AryFix.c') 
    src += Glob('ResourcePlot/RPTools.c') 
    if GetDepend('SUPPORT_RP_GUIDE3X3'):
      src += Glob('ResourcePlot/RP_Guide3X3.c') 
    if GetDepend('SUPPORT_TXT2FILE'):
      src += Glob('ResourcePlot/RP_Txt2File.c') 
    if GetDepend('SUPPORT_TXT_TMENU'):
      src += Glob('ResourcePlot/RP_TxtTMenu.c')      

if GetDepend('SUPPORT_RESTORE'):
    CPPPATH.append(cwd + '/Restore')
    src += Glob('Restore/Restore.c') 

if GetDepend('SUPPORT_SDRAM'):
    CPPPATH.append(cwd + '/SDRAM')
    if GetDepend('SUPPORT_SDRAM_STM32FMC'): 
      src += Glob('SDRAM/STM32FMC.c') 
    elif GetDepend('SUPPORT_SDRAM_SWM341'): 
      src += Glob('SDRAM/SDRAM_SWM341.c') 

if GetDepend('SUPPORT_SENSE'):
    CPPPATH.append(cwd + '/Sense')
    src += Glob('Sense/Sense.c') 

if GetDepend('SUPPORT_SHORT_MNG'):
    CPPPATH.append(cwd + '/ShortMng')
    if GetDepend('SUPPORT_SHORT_MNG_ARY'): 
      src += Glob('ShortMng/ShortMngAry.c') 
    else: 
      src += Glob('ShortMng/ShortMng.c') 

if GetDepend('SUPPORT_SOFT_Q'):
    CPPPATH.append(cwd + '/SoftQ')
    src += Glob('SoftQ/SoftQ.c') 

if GetDepend('SUPPORT_SPL06'):
    CPPPATH.append(cwd + '/SPL06')
    src += Glob('SPL06/SPL06.c') 
    if GetDepend('SUPPORT_SPL06_SPI3MIO'):
        src += Glob('SPL06/SPL06_cbSpi3mio.c') 

if GetDepend('SUPPORT_SWD_IO'):
    CPPPATH.append(cwd + '/SwdIo')
    if GetDepend('SUPPORT_SWD_IO_ASM32'):
        src += Glob('SwdIo/SwdIo_ASM32.c') 
    elif GetDepend('SUPPORT_SWD_IO_HC32F4'):
        src += Glob('SwdIo/SwdIo_HC32F4.c') 
    elif GetDepend('SUPPORT_SWD_IO_STM32'):
        src += Glob('SwdIo/SwdIo_STM32.c') 
    elif GetDepend('SUPPORT_SWD_IO_SWM341'):
        src += Glob('SwdIo/SwdIo_SWM341.c') 

if GetDepend('SUPPORT_SYS_TICK'):
    CPPPATH.append(cwd + '/SysTick')
    if GetDepend('SUPPORT_SYS_TICK_CMISIS_T24'):
      src += Glob('SysTick/SysTick_CMSIS_T24.c') 
    elif GetDepend('SUPPORT_SYS_TICK_CMISIS'):
      src += Glob('SysTick/SysTick_CMSIS.c') 

if GetDepend('SUPPORT_SYS_TIMER'):
    CPPPATH.append(cwd + '/SysTimer')
    src += Glob('SysTimer/SysTimer.c') 

if GetDepend('SUPPORT_TEMP'):
    CPPPATH.append(cwd + '/Temp')
    if GetDepend('SUPPORT_TEMP_MONO'):
      src += Glob('Temp/Temp.c') 
      if GetDepend('SUPPORT_TEMP_MONO_NTC10K_3380K'):
          src += Glob('Temp/Temp_NTC10K_3380K.c') 
      if GetDepend('SUPPORT_TEMP_MONO_SMENU'):
          src += Glob('Temp/Temp_SMenu.c') 
    if GetDepend('SUPPORT_TEMP_ARY'):
      src += Glob('Temp/TempAry.c') 
    if GetDepend('SUPPORT_TEMP_DEV'):
      src += Glob('Temp/TempDev.c') 
      if GetDepend('SUPPORT_TEMP_DEV_HC32'):
          src += Glob('Temp/Temp_DevDesc_HC32.c') 
      if GetDepend('SUPPORT_TEMP_DEV_NTC10K_3380K'):
          src += Glob('Temp/Temp_DevDesc_NTC10K_3380K.c') 

if GetDepend('SUPPORT_TEST'):
    CPPPATH.append(cwd + '/Test')
    src += Glob('Test/Test.c') 

if GetDepend('SUPPORT_ZIP_TIME'):
    CPPPATH.append(cwd + '/ZipTime')
    src += Glob('ZipTime/ZipTime.c') 
    if GetDepend('SUPPORT_ZIP_TIME_EX'):
        src += Glob('ZipTime/ZipTime_Ex.c') 
    if GetDepend('SUPPORT_ZIP_TIME_SMENU'):
        src += Glob('ZipTime/ZipTime_SMenu.c') 
    if GetDepend('SUPPORT_ZIP_TIME_TMENU'):
        src += Glob('ZipTime/ZipTime_TMenu.c') 

#增加SUPPORT_EX_PREINCLUDE定义以预包含Preinclude.h
predefine = ['SUPPORT_EX_PREINCLUDE']
group = DefineGroup('CompMix', src, depend = [''], CPPPATH=CPPPATH, CPPDEFINES = predefine)

Return('group')
